import {Navigate, NavLink, useRoutes} from "react-router-dom";
import Home from "../pages/Home";
import News from "../pages/News";
import Message from "../pages/Message";
import Details from "../pages/Details";
import About from "../pages/About";


export default function useRouters(){
    return useRoutes([
        {
            path:'/home',
            element:<Home/>,
            children:[
                {
                    path:'news',
                    element:<News/>
                },{
                    path:'message',
                    element:<Message/>,
                    children:[
                        {
                            path:':id',
                            element:<Details/>
                        }
                    ]
                },{
                    index:true,
                    element:<Navigate to={'message'}/>
                }
            ]
        },{
            path:'/about',
            element:<About/>
        },{
            path:'/',
            element:<Navigate to={'/home'}/>
        }
    ])
}